package com.lgr.store.service;



import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lgr.store.dao.MaterialTypeDAO;
import com.lgr.store.utils.PageObject;
import com.lgr.store.vo.MaterialTypeVo;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MaterialTypeService {
    @Resource
    MaterialTypeDAO materialTypeVoDAO;

    //查询
    public List<MaterialTypeVo> list(MaterialTypeVo materialType, PageObject pager){
        List<MaterialTypeVo> classtypeList = materialTypeVoDAO.listAll(materialType,pager);
        return classtypeList;
    }
    //查询记录数
    public int count(MaterialTypeVo materialType){
        return materialTypeVoDAO.getcount(materialType);
    }
    //新增
    public void add(MaterialTypeVo materialType){
        materialTypeVoDAO.add(materialType);
    }
    //删除
    @Transactional
    public void delete(Integer materialTypeId){
        materialTypeVoDAO.deleteById(materialTypeId);
    }
    //修改
    @Transactional
    public void update(MaterialTypeVo materialType){
        materialTypeVoDAO.update(materialType);
    }
    //获取一条数据
    @Transactional
    public MaterialTypeVo findById(Integer materialTypeId){
        return materialTypeVoDAO.findById(materialTypeId);
    }
}